<template>
  <div class="margin-container-list">
    <div class="top-operate">
      <el-input style="width: 200px;" v-model="searchListQuery.nickname" placeholder="请输入店主昵称/姓名/手机号"></el-input>
      <el-button type="primary" @click="handleSearch" style="margin-left: 10px">查询</el-button>
      <el-button plain="" @click="resetSearch">重置</el-button>
    </div>
    <!-- 内容列表 -->
    <div class="table-container">
      <el-table ref="multipleTable" :data="liveRoomDetailList" v-loading="listLoading" element-loading-text="加载中" style="width: 100%" >
        <el-table-column label="店主信息">
          <template slot-scope="scope">
            <div class="flex v-align-c cursor-p">
              <label><img :src="scope.row.avatar" class="user-avatar-r" v-if="scope.row.avatar"></label>
              <div class="font-14 pad-l-10">
                <div>昵称：{{scope.row.nickname}}</div>
                <div>姓名：{{scope.row.realName}}</div>
                <div>手机：{{scope.row.phone}}</div>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="成交订单数（笔）" prop="orderNum"></el-table-column>
        <el-table-column label="成交总金额（元）" prop="orderPrice"></el-table-column>
      </el-table>
    </div>
    <!-- 列表分页 -->
    <div class="pagination">
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
                     :current-page="searchListQuery.currentPage"
                     :page-sizes="[10, 20, 50, 100]" :page-size="searchListQuery.size"
                     layout="total, sizes, prev, pager, next, jumper"
                     :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<style lang="less" scoped>
  .time-line{
    width: 20%;
    float: left;
    .time-box{
      position: fixed;
      width: 19%;
      right: 0;
      top: 95px;
    }
  }
  .user-avatar-r{
    width: 46px;
    height: 46px;
    display: block;
    border-radius: 50px;
  }
  .detila-div-80{
    float: left;
    width: 80%;
  }

  .div-styls{
    margin-top: 30px;
    margin-bottom: 20px;
  }
  .el-tabs__item{
    font-size: 20px;
  }
</style>

<script>
  import { pagingLiveDetail } from '@/api/user/liveRoom'
  export default {
    props: {
      roomId: {
        type: String
      }
    },
    data() {
      return {
        dict: {},
        searchListQuery: {
          enterpriseId: this.getEnterpriseId(),
          currentPage: 1,
          size: 10,
          nickname: ''
        },
        total: 0,
        liveRoomDetailList: [],
        listLoading: false
      }
    },
    // 初始化页面
    created() {
      this.handleSearch()
    },
    mounted() {
    },
    methods: {
      // 更改当前页数
      handleCurrentChange(val) {
        this.searchListQuery.currentPage = val
        this.handleSearch()
      },
      // 更改当前页面大小
      handleSizeChange(val) {
        this.searchListQuery.size = val
        this.handleSearch()
      },
      handleSearch() {
        this.searchListQuery['roomId'] = this.roomId
        pagingLiveDetail(this.searchListQuery).then(response => {
          if (response.isError) return
          this.liveRoomDetailList = response.data.records
          this.total = response.data.total
          this.dict = response.data.dict
        })
      },
      resetSearch() {
        this.searchListQuery.currentPage = 1
        this.searchListQuery.nickname = ''
        this.handleSearch()
      }
    }
  }
</script>
